# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.VMwareEngine.V1.Model.AutoscalingPolicy do
  @moduledoc """
  Autoscaling policy describes the behavior of the autoscaling with respect to the resource utilization. The scale-out operation is initiated if the utilization exceeds ANY of the respective thresholds. The scale-in operation is initiated if the utilization is below ALL of the respective thresholds.

  ## Attributes

  *   `consumedMemoryThresholds` (*type:* `GoogleApi.VMwareEngine.V1.Model.Thresholds.t`, *default:* `nil`) - Optional. Utilization thresholds pertaining to amount of consumed memory.
  *   `cpuThresholds` (*type:* `GoogleApi.VMwareEngine.V1.Model.Thresholds.t`, *default:* `nil`) - Optional. Utilization thresholds pertaining to CPU utilization.
  *   `grantedMemoryThresholds` (*type:* `GoogleApi.VMwareEngine.V1.Model.Thresholds.t`, *default:* `nil`) - Optional. Utilization thresholds pertaining to amount of granted memory.
  *   `nodeTypeId` (*type:* `String.t`, *default:* `nil`) - Required. The canonical identifier of the node type to add or remove. Corresponds to the `NodeType`.
  *   `scaleOutSize` (*type:* `integer()`, *default:* `nil`) - Required. Number of nodes to add to a cluster during a scale-out operation. Must be divisible by 2 for stretched clusters. During a scale-in operation only one node (or 2 for stretched clusters) are removed in a single iteration.
  *   `storageThresholds` (*type:* `GoogleApi.VMwareEngine.V1.Model.Thresholds.t`, *default:* `nil`) - Optional. Utilization thresholds pertaining to amount of consumed storage.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :consumedMemoryThresholds => GoogleApi.VMwareEngine.V1.Model.Thresholds.t() | nil,
          :cpuThresholds => GoogleApi.VMwareEngine.V1.Model.Thresholds.t() | nil,
          :grantedMemoryThresholds => GoogleApi.VMwareEngine.V1.Model.Thresholds.t() | nil,
          :nodeTypeId => String.t() | nil,
          :scaleOutSize => integer() | nil,
          :storageThresholds => GoogleApi.VMwareEngine.V1.Model.Thresholds.t() | nil
        }

  field(:consumedMemoryThresholds, as: GoogleApi.VMwareEngine.V1.Model.Thresholds)
  field(:cpuThresholds, as: GoogleApi.VMwareEngine.V1.Model.Thresholds)
  field(:grantedMemoryThresholds, as: GoogleApi.VMwareEngine.V1.Model.Thresholds)
  field(:nodeTypeId)
  field(:scaleOutSize)
  field(:storageThresholds, as: GoogleApi.VMwareEngine.V1.Model.Thresholds)
end

defimpl Poison.Decoder, for: GoogleApi.VMwareEngine.V1.Model.AutoscalingPolicy do
  def decode(value, options) do
    GoogleApi.VMwareEngine.V1.Model.AutoscalingPolicy.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.VMwareEngine.V1.Model.AutoscalingPolicy do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
